package cn.hdu.liang;

import java.util.Scanner;

public class Solution {
    public static int lastSmall(int[] nums, int target) {
        int low = 0;
        int high = nums.length - 1;

        while(low < high - 1) {
            int mid = (low + high) / 2;
            if(target >= nums[mid]) {
                low = mid;
            } else {
                high = mid;
            }
        }
        return low;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] item = new int[n];
        int[] sum = new int[n];
        item[0] = sc.nextInt();
        sum[0] = item[0];
        for(int i = 1; i < n; i++) {
            item[i] = sc.nextInt();
            sum[i] = sum[i - 1] + item[i];
        }

        int t;
        int leftIndex = lastSmall(sum, sum[n - 1] / 2);
        int rightIndex;
        if(sum[n - 1] % 2 == 0 && sum[leftIndex] == sum[n - 1] / 2) {
            t = 2;
            leftIndex--;
        } else {
            t = 1;
        }
        rightIndex = leftIndex + 1;

        while(leftIndex >= 0 && rightIndex < n) {

            while(rightIndex < n && sum[rightIndex] < sum[n - 1] - sum[leftIndex]) {
                rightIndex++;
            }
            if(rightIndex >= n - 1) {
                break;
            }
            if(sum[rightIndex] == sum[n - 1] - sum[leftIndex]) {
                t += 2;
                leftIndex--;
                continue;
            }
            while(leftIndex >= 0 && sum[leftIndex] > sum[n - 1] - sum[rightIndex]) {
                leftIndex--;
            }
            if(leftIndex < 0) {
                break;
            }
            if(sum[leftIndex] == sum[n - 1] - sum[rightIndex]) {
                t += 2;
                rightIndex++;
            }
        }
        System.out.println(n - t);
    }
}
